#include "widget.h"
#include "ui_widget.h"
#include<QTimer>
#include<QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    timer=new QTimer(this);
    connect(timer,&QTimer::timeout,this,&Widget::updatetime);
    timer->start(1000);

}

Widget::~Widget()
{
    delete ui;
}

void Widget::updatetime()
{
//    ui->lcdNumber->display(10);
    int value=ui->lcdNumber->intValue();

//    qDebug()<<value;
    if(value<=0)
    {
        timer->stop();
        return;
    }
    ui->lcdNumber->display(value-1);

}

